Add iopl virtualisation to Linux 2.6. ioport.c is shared with 2.4.
3e5a4e65ibVQmwlOn0j3sVH_j_6hAg linux-2.4.26-xen-sparse/arch/xen/kernel/evtchn.c
3e5a4e65Hy_1iUvMTPsNqGNXd9uFpg linux-2.4.26-xen-sparse/arch/xen/kernel/head.S
3e5a4e65RMGcuA-HCn3-wNx3fFQwdg linux-2.4.26-xen-sparse/arch/xen/kernel/i386_ksyms.c
-3e5a4e65MEvZhlr070sK5JsfAQlv7Q linux-2.4.26-xen-sparse/arch/xen/kernel/ioport.c
3e5a4e653U6cELGv528IxOLHvCq8iA linux-2.4.26-xen-sparse/arch/xen/kernel/irq.c
3e5a4e65muT6SU3ck47IP87Q7Ti5hA linux-2.4.26-xen-sparse/arch/xen/kernel/ldt.c
4051db84bZeRX7a_Kh6VyyDuT5FOIg linux-2.4.26-xen-sparse/arch/xen/kernel/pci-dma.c
40f56238xFQe9T7M_U_FItM-bZIpLw linux-2.6.7-xen-sparse/arch/xen/i386/kernel/evtchn.c
40f56238bnvciAuyzAiMkdzGErYt1A linux-2.6.7-xen-sparse/arch/xen/i386/kernel/head.S
40f58a0d31M2EkuPbG94ns_nOi0PVA linux-2.6.7-xen-sparse/arch/xen/i386/kernel/i386_ksyms.c
+40faa751_zbZlAmLyQgCXdYekVFdWA linux-2.6.7-xen-sparse/arch/xen/i386/kernel/ioport.c
40f562382aC3_Gt4RG-4ZsfvDRUg3Q linux-2.6.7-xen-sparse/arch/xen/i386/kernel/irq.c
40f56238ue3YRsK52HG7iccNzP1AwQ linux-2.6.7-xen-sparse/arch/xen/i386/kernel/ldt.c
40f56238a8iOVDEoostsbun_sy2i4g linux-2.6.7-xen-sparse/arch/xen/i386/kernel/process.c
+++ /dev/null
-#include <linux/sched.h>
-#include <linux/kernel.h>
-#include <linux/errno.h>
-#include <linux/types.h>
-#include <linux/stddef.h>
-#include <asm/hypervisor-ifs/dom0_ops.h>
-
-
-asmlinkage int sys_iopl(unsigned int new_io_pl)
-{
- unsigned int old_io_pl = current->thread.io_pl;
- dom0_op_t op;
-
- if ( !(start_info.flags & SIF_PRIVILEGED) )
- return -EPERM;
-
- if ( new_io_pl > 3 )
- return -EINVAL;
-
- /* Need "raw I/O" privileges for direct port access. */
- if ( (new_io_pl > old_io_pl) && !capable(CAP_SYS_RAWIO) )
- return -EPERM;
-
- /* Maintain OS privileges even if user attempts to relinquish them. */
- if ( (new_io_pl == 0) && (start_info.flags & SIF_PRIVILEGED) )
- new_io_pl = 1;
-
- /* Change our version of the privilege levels. */
- current->thread.io_pl = new_io_pl;
-
- /* Force the change at ring 0. */
- op.cmd = DOM0_IOPL;
- op.u.iopl.domain = DOMID_SELF;
- op.u.iopl.iopl = new_io_pl;
- HYPERVISOR_dom0_op(&op);
-
- return 0;
-}
-
-
-asmlinkage int sys_ioperm(unsigned long from, unsigned long num, int turn_on)
-{
- printk(KERN_INFO "ioperm not fully supported - %s\n",
- turn_on ? "set iopl to 3" : "ignore resource release");
- return turn_on ? sys_iopl(3) : 0;
-}
-
-
ln -sf ../../i386/kernel/ptrace.c
ln -sf ../../i386/kernel/semaphore.c
ln -sf ../../i386/kernel/sys_i386.c
+ln -sf ../../../${LINUX_26}/arch/xen/i386/kernel/ioport.c
cd ../lib
ln -sf ../../i386/lib/checksum.S
ln -sf ../../i386/lib/dec_and_lock.c
--- /dev/null
+#include <linux/sched.h>
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <linux/types.h>
+#include <linux/ioport.h>
+#include <linux/mm.h>
+#include <linux/smp.h>
+#include <linux/smp_lock.h>
+#include <linux/stddef.h>
+#include <linux/slab.h>
+#include <asm/hypervisor-ifs/dom0_ops.h>
+
+asmlinkage long sys_iopl(unsigned int new_io_pl)
+{
+ unsigned int old_io_pl = current->thread.io_pl;
+ dom0_op_t op;
+
+ if (!(start_info.flags & SIF_PRIVILEGED))
+ return -EPERM;
+
+ if (new_io_pl > 3)
+ return -EINVAL;
+
+ /* Need "raw I/O" privileges for direct port access. */
+ if ((new_io_pl > old_io_pl) && !capable(CAP_SYS_RAWIO))
+ return -EPERM;
+
+ /* Maintain OS privileges even if user attempts to relinquish them. */
+ if (new_io_pl == 0)
+ new_io_pl = 1;
+
+ /* Change our version of the privilege levels. */
+ current->thread.io_pl = new_io_pl;
+
+ /* Force the change at ring 0. */
+ op.cmd = DOM0_IOPL;
+ op.u.iopl.domain = DOMID_SELF;
+ op.u.iopl.iopl = new_io_pl;
+ HYPERVISOR_dom0_op(&op);
+
+ return 0;
+}
+
+asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int turn_on)
+{
+ printk(KERN_INFO "ioperm not fully supported - %s\n",
+ turn_on ? "set iopl to 3" : "ignore resource release");
+ return turn_on ? sys_iopl(3) : 0;
+}
struct pt_regs * childregs;
struct task_struct *tsk;
int err;
+ unsigned long eflags;
childregs = ((struct pt_regs *) (THREAD_SIZE + (unsigned long) p->thread_info)) - 1;
struct_cpy(childregs, regs);
desc->b = LDT_entry_b(&info);
}
+
+ __asm__ __volatile__ ( "pushfl; popl %0" : "=r" (eflags) : );
+ p->thread.io_pl = (eflags >> 12) & 3;
+
err = 0;
out:
if (err && p->thread.io_bitmap_ptr)
*/
load_TLS(next, cpu);
+ if (start_info.flags & SIF_PRIVILEGED) {
+ dom0_op_t op;
+ op.cmd = DOM0_IOPL;
+ op.u.iopl.domain = DOMID_SELF;
+ op.u.iopl.iopl = next->io_pl;
+ HYPERVISOR_dom0_op(&op);
+ }
+
local_irq_restore(flags);
/*
conswitchp = &dummy_con;
#endif
#endif
+
+ /* If we are a privileged guest OS then we should request IO privs. */
+ if (start_info.flags & SIF_PRIVILEGED) {
+ dom0_op_t op;
+ op.cmd = DOM0_IOPL;
+ op.u.iopl.domain = DOMID_SELF;
+ op.u.iopl.iopl = 1;
+ if (HYPERVISOR_dom0_op(&op) != 0)
+ panic("Unable to obtain IOPL, despite SIF_PRIVILEGED");
+ current->thread.io_pl = 1;
+ }
}
#include "setup_arch_post.h"
unsigned long esp;
unsigned long fs;
unsigned long gs;
+ unsigned int io_pl;
/* Hardware debugging registers */
unsigned long debugreg[8]; /* %%db0-7 debug registers */
/* fault info */